<template>
  <table
    class="m-table"
    border="1"
    cellpadding="0"
    cellspacing="0"
    style="width:1190px;border:none; text-align:center;"
  >
    <tr>
      <td colspan="6">
        <p class="title">
            {{h1}}
        </p>
      </td>
    </tr>
    <tr>
      <td colspan="6"><p class="title">{{h2}}</p></td>
    </tr>
    <tr class="content-text">
      <td>施工单位:</td>
      <td colspan="2">{{sgCompany}}</td>
      <td>监理单位:</td>
      <td colspan="2">{{jlCompany}}</td>
    </tr>
    <tr class="content-text">
      <td>合同段:</td>
      <td colspan="2">{{htdpart}}</td>
      <td>起讫桩号:</td>
      <td colspan="2">{{qqzhNumber}}</td>
    </tr>
    <tr class="content-text">
      <td>工程名称:</td>
      <td colspan="5">
        <Input v-model="mydwname" @on-blur="changeDWname(mydwname)" placeholder="请输入工序名称" />
      </td>
    </tr>
  </table>
</template>

<script>
import { editDWname } from '@/api/approval.js';

export default {
  name: 'table-header',
  props: {
    dwnodeid: {
      type: String | Number,
      required: true
    },
    h1: {
      type: String,
      required: true
    },
    h2: {
      type: String,
      required: true
    },
    sgCompany: {
      type: String,
      required: true
    },
    jlCompany: {
      type: String,
      required: true
    },
    htdpart: {
      type: String,
      required: true
    },
    qqzhNumber: {
      type: String,
      required: true
    },
    projectName: {
      type: String,
      required: true
    },
    dwname: String
  },
  data () {
    return {
      mydwname: this.dwname
    };
  },
  watch: {
    dwname (newV, oldV) {
      this.mydwname = newV;
    }
  },
  methods: {
    // 修改工程名称
    async changeDWname (value) {
      const send = { id: this.dwnodeid, nodeName: this.mydwname };
      // console.log(send, 'sadasdasassad');
      // return;
      try {
        const resp = await editDWname(send);
        console.log(resp);
      } catch (error) {}
    }
  }

};
</script>
<style lang="less" scoped>
@import '../assets/css/common.css';
/deep/ .ivu-input{
  font-size:14px;
  color:#333;
  text-align:center;
  border:none;
  &:focus{
  outline:none;
   box-shadow: none;
  }
}
</style>
